package cn.net.autocode.platform.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 *
 */
@Configuration
public class DataSourceConfig {

    //主数据源
    @Primary
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.data")
    public DataSource dataDataSource() {
        return DataSourceBuilder.create().build();
    }


    //主读数据源
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.dict")
    public DataSource dictDataSource() {
        return DataSourceBuilder.create().build();
    }

}